import java.util.Arrays;

public class test3 {
    public static void main(String[] args) {
        int [] arrays = {1,2,3,4,5,6,7,7,8,9};
        int target = 14;//整数目标值
        System.out.println(Arrays.toString(fun(arrays, target)));
    }
    public static int [] fun(int [] array, int n) {//如果找不到输出0
        int []arrays = new int[2];
        for (int i = 0; i < array.length-1; i++) {
            for (int j = i+1; j < array.length; j++) {
                if(array[i] + array[j] == n && array[i] !=array[j]) {
                    arrays[0] = array[i];
                    arrays[1] = array[j];
                }
            }
        }
        return arrays;
    }
}
